import {createRouter, createWebHistory} from 'vue-router'

import Layout from '../layout/index.vue'

// 公共路由
const constantRoutes = [
    //登录
    {
        path: '/login',
        component: () => import('/src/views/login.vue'),
        hidden: true
    },
    //注册
    {
        path: '/register',
        component: () => import('/src/views/register.vue'),
        hidden: true
    },
    {
        path: '/404',
        component: () => import('/src/views/error/404.vue'),
        hidden: true
    },
    {
        path: '/401',
        component: () => import('/src/views/error/401.vue'),
        hidden: true
    },
    //首页
    {
        path: '/',
        component: Layout,
        hidden: true,
        children: [
            {
                path: 'index',
                component: () => import('/src/views/index.vue'),
                name: '首页',
                meta: {title: '首页', icon: 'dashboard', noCache: true, affix: true}
            },
            {
                //个人中心
                path: 'profile',
                component: () => import('/src/views/system/user/profile/index.vue'),
                hidden: true
            },
        ]
    },
    //字典数据
    {
        path: '/system/dict-data/',
        component: Layout,
        hidden: true,
        children: [
            {
                path: 'index/:dictType(\\w+)',
                component: () => import('/src/views/system/dict/data.vue'),
                name: 'Data',
                meta: {title: '字典数据', activeMenu: '/system/dict'},
                props: true
            }
        ]
    },
    //规则引擎
    {
        path: '/rule',
        component: () => import('/src/views/rule/engine/index.vue'),
        hidden: true
    },
    //视频流
    {
        path: '/stream',
        component: () => import('/src/views/stream/manage/index.vue'),
        hidden: true
    },
]


const routerHistory = createWebHistory()

const router = createRouter({
    history: routerHistory,
    routes: constantRoutes
})

export {router, constantRoutes}
